package com.sfzy.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.Psych;
import com.sfzy.mapper.PsychMapper;
import com.sfzy.service.PsychService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PsychServiceImpl
 * @Description TODO
 * @Author niejiacan
 * @Date 2025年08月13日 21:29
 * @Version 1.0
 */
@Service
public class PsychServiceImpl implements PsychService {
    @Autowired
    private PsychMapper psychMapper;

    @Override
    public int addPsych(Psych psych) {
        return psychMapper.addPsych(psych);
    }

    @Override
    public int updatePsych(Psych psych) {
        return psychMapper.updatePsych(psych);
    }

    @Override
    public int deletePsych(int id) {
        return psychMapper.deletePsych(id);
    }

    @Override
    public Psych selectPsych(int id) {
        return psychMapper.selectPsych(id);
    }

    @Override
    public PageInfo<Psych> pageTitle(Psych psych, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Psych> psyches = psychMapper.pageTitle(psych);
        PageInfo<Psych> info = new PageInfo<>(psyches);
        return info;
    }
}
